<?php

namespace app\store\service;

use app\store\model\GoodsTag;

class GoodsTagService
{

    public function getGoodsTagList($keyword)
    {   
        $store_id = session('store_id');

        $model = new GoodsTag();
        $query = $model->withOutField('desc')->where('store_id',$store_id);
        if(!empty($keyword)){
            $query->whereLike('tag_name',"%$keyword%");
        }
        $goodsTags = $query->select();
        
        return  $goodsTags;
        
    }

    public static function  getGoodsTagOptions()
    {   
        $store_id = session('store_id');

        $model = new GoodsTag();
        $goodsTags = $model->field('id,tag_name')->where(['store_id' => $store_id,'status' => 1])->select();

        return  $goodsTags;
        
    }

    public function findGoodsTag($id)
    {
        $model = new GoodsTag();
        $goodsTag = $model->withOutField('create_time,update_time')->find($id);
    
        
        return $goodsTag;
        
    }

    
}